/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.dsw2.bar.dao;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import mx.itschapala.dsw2.bar.modelo.DetalleVenta;

/**
 *
 * @author Dhavis
 */
@Stateless
public class BebidaDao implements BebidaDaoLocal {
    @PersistenceContext(unitName = "PuntoVentaBar-ejbPU")
    private EntityManager em;

    public boolean findDuplicity(DetalleVenta drink) {
        //seleccionar consulta
        Query q= em.createNamedQuery("Autor.findDuplicity");
        //poner parametros
        q.setParameter("nombre",drink.getBebida());
        q.setParameter("apellidoPaterno",drink.getCantidad());
        //ejecutar
        return !q.getResultList().isEmpty();
    }
}
